import type { RefMapContext, SceneConfig, RefMapScene } from "@/modules/map";
import { type ModuleConfig, BaseModule } from "@/context";

export interface MapModuleConfig extends ModuleConfig {
    scene: SceneConfig;
}

export class MapModule extends BaseModule<MapModuleConfig> {
    declare context: RefMapContext;
    declare scene: RefMapScene;
    protected async _init(config: MapModuleConfig): Promise<void> {
        const comp = await import("@/modules/map");
        this.config = config;
        this.context = new comp.RefMapContext();
        this.scene = comp.createRefMapScene(config.scene);
        this.context.addMapScene(this.scene);
    }
    protected async _destroy(): Promise<void> {
        await this.context.destroy();
    }
}
